<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="renderer" content="webkit">
    <meta name="format-detection" content="telephone=no">
    <meta name="csrf-param" content="_homeCSRF">
    <meta name="csrf-token" content="RkJLbXljbG93b3M5JjsZG3MsCidNDg4lISl9DApUKBwCcBgnQCoEXw==">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="../src/img/favicon.ico" rel="shortcut icon">
    <link href="/images/favicon.ico" rel="bookmark">
    <link href="../src/css/jquery.bxslider.css" rel="stylesheet">
    <link href="../src/iconfonts/iconfont.css" rel="stylesheet">
    <link href="../src/css/bootstrap.css" rel="stylesheet">
    <link href="../src/css/dookayui.css" rel="stylesheet">
    <link href="../src/css/dx.css" rel="stylesheet">
    <link href="../src/css/dy.css" rel="stylesheet">
    <!--[if lte IE9]>
    <script src="../src/js/html5shiv.js"></script>
    <![endif]-->
    <!--[if lte IE9]>
    <script src="../src/js/respond.min.js"></script>
    <![endif]-->

    <link rel="stylesheet" href="../src/css/special-reset.css">
    <script src="../src/js/jquery-2.1.4.js"></script>

    <style>
        .dy-thumbnail {
            padding: 30px 31px 0px 33px;
            margin-bottom: 50px;
            border-radius: 0;
            height: 330px;
            position: relative;
        }
        *{
            box-sizing: border-box;
        }
        .dy-thumbnail .caption .social-time {
            position: absolute;
            bottom: 15px;
        }
        .dy-thumbnail .caption .social-time>a {
            position: absolute;
            right: -245%;
        }
    </style>

</head>
<body class="">
<div class="header"></div>
<div id="pbody" class="bg-gray dx-content" style='box-sizing: border-box;'>

    <div class="container dy-show">
        <div class="title mb-5 pengxin-news-title">
            <h2 class="font-20 english-title"></h2>
            <p class="font-20 article-title"></p>
        </div>
        <div class="row" id="load-data">
        </div>
    </div>
</div>
<nav class="text-center" style="margin: 3% 0; justify-content: center;display: flex;">
</nav>
<footer class="footer">

    <!--公司信息结束-->
</footer>

<script src="http://192.168.100.181:8080/huoge-edu/src/js/dookayui.min.js"></script>
<script src="http://192.168.100.181:8080/huoge-edu/src/js/common.js"></script>
<script>
    $(function () {
        //轮播
        $(".j_project_slider").bxSlider({
            auto: false,
            pager: false,
            minSlides: 3,
            maxSlides: 3,
            moveSlides: 1,
            slideWidth: 383.33
        });

    });
</script>
<script>
    $(function () {
        commonApp.init();
    })

    $(document).ready(function () {

        $(".header").load("http://192.168.100.181:8080/huoge-edu/public-file/secondMenu-header.html", function () {
            $(".px-mobile .dy-nav .bread").on("click", function () {
                $(".px-mobile .main-nav").slideToggle("slow");
            });
        });
        setTimeout(function () {

            $(".footer").load("http://192.168.100.181:8080/huoge-edu/public-file/footer.html");
        }, 250)

        var intervalIndex = setInterval(function () {
            if ($($('.active')[2])[0]) {
                getAllpanel();
                clearInterval(intervalIndex);
                var text = $($('.active')[2])[0].innerText;
                $('.english-title').html($($('.active')[2]).data('english'));
                $('.article-title').html(text);
                document.title = text;
            }
        }, 100);


        function serilizeURL(url) {
            var rs = url.split("?")[1];
            var arr = rs.split("&");
            var json = {};
            for (var i = 0; i < arr.length; i++) {
                if (arr[i].indexOf("=") != -1) {
                    json[arr[i].split("=")[0]] = arr[i].split("=")[1];
                }
                else {
                    json[arr[i]] = "undefined";
                }
            }
            return json;
        }

        function getAllpanel() {

            var panelLists;
            var panelListsLength;

            var url = location.href;
            var second_id = serilizeURL(url);
            var secondMenuId = second_id.secondMenuId;
            var pid = serilizeURL(url).pid;
            $.ajax({
                url: "http://192.168.100.181:8080/api/article/queryArticleByColumn?id=" + secondMenuId,
                success: function (data) {
                    panelLists = data.data;
                    panelListsLength = panelLists.length;

                    console.log(panelListsLength);
                    $("#load-data").empty();
                    $('.text-center').empty();
                    $('.text-center').append(`
                    <ul class="pagination">
                        <a class="add-a-style prev" href="javascript:void(0)" selectPage="0">上一页</a>
                        <span></span>
                        <a class="add-a-style next" href="javascript:void(0)" selectPage="0">下一页</a>
                    </ul>`)

                    function pagingContent(i) {
                        $("#load-data").append("<div class='col-md-4 col-sm-6 col-xs-12' > <div class='thumbnail dy-thumbnail' > <div class='social-pic'>  <a href='http://192.168.100.181:8080/huoge-edu/common/article-details.html?articleId=" + panelLists[i].id + "&pid=" + pid + "&secondMenuId=" + secondMenuId + "'> <img src='" + panelLists[i].coverImageUrl + "' alt='666.jpg'>   </a> </div> <div class='caption'><p class='social-main ellipsis-2l'>" + panelLists[i].title + "</p><p class='social-time'>" + panelLists[i].createDate.substring(0, 10) + "<a href='http://192.168.100.181:8080/huoge-edu/common/article-details.html?articleId=" + panelLists[i].id + "&pid=" + pid + "&secondMenuId=" + secondMenuId + "' class='iconfont icon-jiantou2'></a></p> </div> </div> </div>")
                    }
                    //分页
                    var Count = data.data.length;//记录条数
                    var PageSize = 4;//设置每页示数目
                    var PageCount = Math.ceil(Count / PageSize);//计算总页数
                    var currentPage = 1;//当前页，默认为1
                    var selectPage = '';//当前在哪一页

                    //分页按钮
                    for (var i = 1; i <= PageCount; i++) {
                        var pageN = '<a class="add-a-style" href="javascript:void(0)" selectPage="' + i + '">' + i + '</a>';
                        $('.text-center .pagination span').append(pageN);
                    }
                    //显示默认页（第一页）
                    for (i = (currentPage - 1) * PageSize; i < PageSize * currentPage; i++) {
                        selectPage = i;
                        pagingContent(selectPage);
                        $('.text-center span a:nth-child(1)').addClass('on');

                    }
                    //显示选择页的内容
                    $('.text-center span a').click(function () {
                        selectPage = $(this).attr('selectPage');
                        $(this).addClass('on').siblings().removeClass('on');
                        $('#load-data').html('');
                        for (i = (selectPage - 1) * PageSize; i < PageSize * selectPage; i++) {
                            pagingContent(i);
                        }
                    });
                    $(".next").click(function () {

                        currentPage= $($('.on')[0]).attr('selectPage');
                        currentPage=parseInt(currentPage)+1; //当前页数
                        $('.text-center span a').eq(currentPage-1).addClass('on').siblings().removeClass('on');

                        if (currentPage <= PageCount) {
                            $('#load-data').html('');
                            for (i = (currentPage - 1) * PageSize; i < PageSize * currentPage; i++) {
                                pagingContent(i);
                            }
                        } else {
                            return;
                        }
                    });
                    $(".prev").click(function () {

                        currentPage= $($('.on')[0]).attr('selectPage');
                        currentPage=parseInt(currentPage)-1; //当前页数
                        $('.text-center span a').eq(currentPage - 1).addClass('on').siblings().removeClass('on');

                        if (currentPage > 0) {
                            $('#load-data').html('');
                            for (i = (currentPage - 1) * PageSize; i < PageSize * currentPage; i++) {
                                pagingContent(i);
                            }
                        } else {
                            return;
                        }
                    });

                }
            });


        };
    });


</script>
</body>
</html>
